From: Colin Walters Date: Fri, 15 Aug 2014 19:21:40 +0000 (-0400) Subject: sysroot: Add precondition that load() has been called for some API calls X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~1129 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6a55d2c32ffcb49de5f4d781315b67dcc885d6f7;p=ostree.git sysroot: Add precondition that load() has been called for some API calls We require the caller to invoke load() at the moment to do most things. --- diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 0c92f269..c88c6d42 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -755,6 +755,8 @@ ostree_sysroot_get_subbootversion (OstreeSysroot *self) OstreeDeployment * ostree_sysroot_get_booted_deployment (OstreeSysroot *self) { + g_return_val_if_fail (self->loaded, NULL); + return self->booted_deployment; } @@ -767,8 +769,12 @@ ostree_sysroot_get_booted_deployment (OstreeSysroot *self) GPtrArray * ostree_sysroot_get_deployments (OstreeSysroot *self) { - GPtrArray *copy = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref); + GPtrArray *copy; guint i; + + g_return_val_if_fail (self->loaded, NULL); + + copy = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref); for (i = 0; i < self->deployments->len; i++) g_ptr_array_add (copy, g_object_ref (self->deployments->pdata[i])); return copy;